GBML manual / Strings

string_pad_right

Adds fill after s until it is width characters long, so columns line up: string_pad_right("hp", 5, ".") is "hp...". Only the first character of fill is used. Text that is already long enough comes back as it was.

Syntax

string_pad_right(s, width, fill) -> string

Arguments

NameType
sstring
widthint
fillstring

Returns

string

Description

Adds fill after s until the text is width characters long, so columns line up. It is string_pad_left with the padding on the other side.

Example

var label = string_pad_right("hp", 5, ".");

label is "hp...".

The small print

Cost

One pass over the text, at most as long as a string can be.

On the GBA

The same rules as string_pad_left, with the padding on the other side: the result is cut off at the end if it would not fit in a string, an empty fill pads with spaces, and text already width long is not changed.

See also: string_pad_leftstring_digitsstring_repeatstring_length